#!/bin/sh
# shellcheck disable=SC2034
RUNNING_USER=root
ADATE=`date +%Y%m%d%H%M%S`
#项目名称
NAME=$2
if [ ! -d "/var/app/server" ];then
  mkdir /var/app
  mkdir /var/app/server
fi
if [ ! -d "/var/app/server-old" ];then
  mkdir /var/app/server-old
fi
install(){
  mvn clean install
}
package(){
  \cp -r /var/app/server/$NAME-bin.zip /var/app/server-old/$NAME-bin-${ADATE}.zip
  \cp -f /project-pattern/package/$NAME-bin.zip /var/app/server/
}

case $1 in
          install) install;;
          package)  package;;
              *)  echo "require install 编译maven|package 打包"  ;;
esac